package com.hankol.newretail.adapter

import android.app.Activity
import androidx.recyclerview.widget.RecyclerView
import com.baselibrary.extension.checkValue
import com.baselibrary.manager.SensorsDataManager
import com.baselibrary.utils.ARouterUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hankol.newretail.R
import com.hankol.newretail.bean.JinGIcon

/* */
class MallMenuAdapter(val act: Activity) : BaseQuickAdapter<List<JinGIcon>, BaseViewHolder>(R.layout.layout_mall_menu_child) {

    override fun convert(helper: BaseViewHolder, item: List<JinGIcon>) {
        val recyclerView = helper.getView<RecyclerView>(R.id.rv_menu_child)
        val adapter = MallMenuChildAdapter()
        recyclerView.adapter = adapter
        adapter.setNewData(item)
        adapter.setOnItemClickListener { _, _, position ->
            val menuBean = adapter.data[position]
            SensorsDataManager.instance.shopJingangClick(menuBean.name.checkValue())
            ARouterUtils.jump(menuBean.routeUrl,act);
        }
    }
}